import { BaseWindow } from "../../../component/window/BaseWindow";
import { ObjCreate } from "../common/ObjCreate";
import { TilePanel } from "../equipment/TilePanel";
import { WalkthroughTypeRenderer } from "./WalkthroughTypeRenderer";
import { Language } from "../../../../extend/language/Language";
import { WalkthroughType } from "./WalkthroughType";
import { WalkthroughSubType } from "./WalkthroughSubType";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class WalkthroughListWindow
    
    export  class WalkthroughListWindow extends BaseWindow
    {
        constructor()
        {
            super();
            this.setSize(460, 390);
            this.title = "";
            this.titleHeight = 28;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 39, 425, 338, this);
            WalkthroughListWindow._typeListPanel = new TilePanel();
            WalkthroughListWindow._typeListPanel.columnWidth = 405;
            WalkthroughListWindow._typeListPanel.rowHeight = 140;
            WalkthroughListWindow._typeListPanel.setSize(405, 280);
            WalkthroughListWindow._typeListPanel.move(37, 60);
            WalkthroughListWindow._typeListPanel.setStyle("cellRenderer", WalkthroughTypeRenderer);
            this.addChild(WalkthroughListWindow._typeListPanel);
            this._gobackBtn = ObjCreate.createGButton(Language.getString(51051), 370, 350, 60, 24, this);
            this._gobackBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onGobackClickHandler);
            return;
        }

        public updateByType(arg1: int): void
        {
            this.title = WalkthroughType.getNameByType(arg1);
            this._dailyArray = WalkthroughSubType.getSubTypeArrayByType(arg1);
            WalkthroughListWindow._typeListPanel.dataProvider = new DataProvider(this._dailyArray);
            return;
        }

        /* internal  */onBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=int((arg1.target as GButton).name);
            return;
        }

        /* internal  */resetWindow(arg1: int): void
        {
            if (arg1 != 1) 
            {
                WalkthroughListWindow._typeListPanel.setSize(405, 280);
            }
            else 
            {
                WalkthroughListWindow._typeListPanel.setSize(400, 260);
            }
            return;
        }

        /* internal  */onGobackClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public static get instance(): WalkthroughListWindow
        {
            if (WalkthroughListWindow._instance == null) 
            {
                WalkthroughListWindow._instance = new WalkthroughListWindow();
            }
            return WalkthroughListWindow._instance;
        }

        /* internal */ /* var */_gobackBtn: GButton;

        /* internal */ /* var */_dailyArray: Array<any>;

        /* internal */ static /* var */_instance: WalkthroughListWindow;

        /* internal */ static /* var */_typeListPanel: TilePanel;
    }
